import React, {useEffect, useRef} from "react";
import './markdown.scss';
// import Markdown from 'react-markdown';
const md = require('markdown-it')();

export const Markdown: React.FC<{
    md: string | null
}> = (props) => {
    const markRef = useRef(null  as HTMLDivElement | null );


    useEffect(()=>{
        markRef.current!.innerHTML = md.render(props.md || '')
    },[props.md]);

    return (
        <div ref={markRef}>
        </div>
    )
};
